using System;
using System.Runtime.Serialization;

namespace Lync.Widget.Library.InstantMessaging
{
	[DataContract]
	public class Message
	{
		public Message(string value, MessageType messageType)
		{
			this.Value = value;
			this.Type = messageType;
		}

		[DataMember]
		public string Value { get; set; }

		// hack to get the enum string return in json format
		[DataMember(Name = "Type")]
		public string TypeString { get; private set; }

		public MessageType Type
		{
			get
			{
				return (MessageType)Enum.Parse(typeof(MessageType), TypeString);
			}
			set
			{
				TypeString = value.ToString();	
			}
		}
	}
}